home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: Newbie: Creating .a files
- Date: 25 Mar 1996 11:25:12 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4j5vqo$ajh@news1.h1.usa.pipeline.com>
- References: <Pine.SOL.3.91.960324201800.26556A-100000@vu-vlsi.ee.vill.edu>
- NNTP-Posting-Host: 38.8.120.13
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Mar 24, 1996 20:18:52 in article <Newbie: Creating .a files>,
- 'Senthilvel Rangaswamy <senthil@ece.vill.edu>' wrote:
-
-
- >Could anybody please explain me what is .a file
- >and how to create one from .o files.
- >
-
- First, .o file. This is an object file produced by your compiler.
- It is binary code, but it is not ready to be run as a standalone
- executable as it is missing certain required header info and is
- incomplete; i.e., 99.99% of the time contains references to external
- definitions. It is the linker's job to collect all the .o and .a
- files together, resolve all the references, and produce a module
- that can be loaded and run by the OS.
-
- Roughly, .a file is a library (archive) file which is a collection
- of routines that can be linked into your program. The main dif-
- ference is that the linker, while including everything in a .o file,
- extracts only what it needs out of a .a file, thereby reducing the
- size of your executable considerably. To serve this end, the .a
- file contains additional info about its contents to enable the
- linker to quickly process archives.
-
- A .a file is produced by the ar processor. Both .o and .a are
- specific to Unix systems. Their approximate counterparts on
- Intel platforms are .obj and .lib, respectively.
-
- To create a .a file from .o's on Solaris:
-
- ar -V ru mylib.a one.o two.o three.o ...etc
-
- Check the man pages on ar for specifics. The above works
- for me, but the -V isn't really needed.
-
- --
- Pete Grant
- Kalevi, Inc.
- Software Engineering & development
-